<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-5-29
 * Time: 下午9:52
 */
class Msupport extends CI_Model{
    function __construct(){
        parent::__construct();
    }

    /**
     * 检查是否已支持过
     * @return bool
     */
    function checkSupport($uid,$supportUid)
    {
        $sql = "select *
            from tbsupport
            where uid = ? and support_uid = ?";
        $query = $this->db->query($sql,array($uid,$supportUid));
        $exists = false;
        if($query->num_rows() > 0){
            $exists = true;
        }
        return $exists;
    }

    function insertSupport($uid,$supportUid)
    {
        $data = array(
            'uid' => $uid ,
            'support_uid' => $supportUid
        );
        $this->Muser->support($uid);
        $this->db->insert('tbsupport', $data);
        return $this->db->insert_id();

    }

}